package com.gps.pe.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.gps.pe.base.api.AbstractPlacementEngineController;
import com.gps.pe.exception.PeException;
import com.gps.pe.utility.StringUtils;


/**
 * HomePage controller class: This is one of the controllers whom are implementing the methods of Abstract class, methods are namely populateBean(), execute() and resolveView()
 * 
 * @author GPS
 *
 */
public class HomePageController extends AbstractPlacementEngineController {
	private static final Logger LOGGER = Logger.getLogger(HomePageController.class);
	@Override
	public final String resolveView(HttpServletRequest req, HttpServletResponse resp) throws PeException {
		LOGGER.debug("Home Page View Resolver called...");
		
		String url = req.getRequestURI();
		
		if(! StringUtils.isStringEmpty(url) && url.contains("displayLogin")) {
			req.setAttribute("centerPageAtrributeHandler", "jobSeekerLogin");
			req.setAttribute("pageIdentifier", "jobSeekerLogin");
		}
		else if(! StringUtils.isStringEmpty(url) && url.contains("displayRegister")) {
			req.setAttribute("centerPageAtrributeHandler", "userRegistration");
			req.setAttribute("pageIdentifier", "userRegistration");
		}
		return "jsp/placementengine.jsp";
	}
}